Skip to content

fix(parser): error on invalid operators in string interpolation#933

Merged
SchoolyB merged 1 commit intobugfixes/1-7-2026from
fix/916-interpolation-invalid-operator-error
Jan 7, 2026
Merged

fix(parser): error on invalid operators in string interpolation#933
SchoolyB merged 1 commit intobugfixes/1-7-2026from
fix/916-interpolation-invalid-operator-error

Conversation

@SchoolyB
Copy link
Copy Markdown
Owner

@SchoolyB SchoolyB commented Jan 7, 2026

Summary

Changes

  • pkg/parser/parser.go: Added checks after parsing interpolated expressions

Test plan

  • ${a & b} now errors: "& is not a valid binary operator in expressions"
  • ${a | b} now errors: "unexpected character '|', did you mean '||'?"
  • ${a ^ b} now errors: "illegal character '^' in expression"
  • Valid operators (+, -, *, /) still work correctly
  • All existing tests pass

String interpolation was silently dropping expressions with invalid
operators (&, |, ^), returning only the first operand. Now checks for
lexer errors and unconsumed tokens after parsing interpolated expressions.
@SchoolyB SchoolyB merged commit 54b03bc into bugfixes/1-7-2026 Jan 7, 2026
2 checks passed
@SchoolyB SchoolyB deleted the fix/916-interpolation-invalid-operator-error branch January 7, 2026 20:02
SchoolyB added a commit that referenced this pull request Apr 3, 2026
#933)

String interpolation was silently dropping expressions with invalid
operators (&, |, ^), returning only the first operand. Now checks for
lexer errors and unconsumed tokens after parsing interpolated expressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant